package com.xxx.mall.api;

import com.xxx.mall.bo.AuthAccountBO;
import com.xxx.mall.context.AuthUserContext;
import com.xxx.mall.response.R;
import com.xxx.mall.service.ShopDetailService;
import com.xxx.mall.service.ShopUserService;
import com.xxx.mall.vo.ShopUserInfoVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 商家用户 前端控制器
 * </p>
 *
 * @author 邢晨旭
 * @since 2023-11-16
 */
@RestController
@RequestMapping("/s/shop_user")
public class ShopUserApi {


    @Resource
    ShopUserService shopUserService;

    @GetMapping("/info")
    public R<ShopUserInfoVO> info() {
        AuthAccountBO authAccountBO = AuthUserContext.get();
        ShopUserInfoVO shopUserInfoVO = shopUserService.getByUserId(authAccountBO.getUserId(), authAccountBO.getTenantId());
        shopUserInfoVO.setIsAdmin(authAccountBO.getIsAdmin());
        return R.ok(shopUserInfoVO);
    }
}
